package niit.wei.controller;

import lombok.extern.slf4j.Slf4j;
import niit.wei.service.RegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author WeiJinLong
 * @Date 2023-08-16 20:17
 * @Version 1.0
 */
@Controller
@Slf4j
public class RegisterController {
    @Autowired
    private RegisterService registerService;

    @RequestMapping("/getPhoneNumber")
    @ResponseBody
    public Object veiFiCodeByNumber(@RequestParam("phoneNumber") Integer phoneNumber, HttpServletRequest request) {
        String remoteAddr = request.getRemoteAddr();
        log.info("前端发送的手机号："+phoneNumber);
        log.info("访问ip为："+remoteAddr);
        return  registerService.veiFiCodeByNumber(phoneNumber,remoteAddr);
    }
}
